Don't commit from reset, it upstets GtkTextView.
authorMatthias Clasen <mclasen@redhat.com>
Tue, 6 Dec 2005 21:21:44 +0000 (21:21 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 6 Dec 2005 21:21:44 +0000 (21:21 +0000)
2005-12-06  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkimcontextsimple.c (gtk_im_context_simple_reset): Don't
commit from reset, it upstets GtkTextView.

* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): Be more
careful when turning blinking on and off.
(gtk_text_view_focus_out_event): Make the cursor really invisible
when the focus goes away.  (#323087, Sadrul Habib Chowdhury)
(cursor_blinks): Check the gtk-cursor-blink setting first.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkimcontextsimple.c
gtk/gtktextview.c

index 5931b5ad2d89e88a5c52b37a321944196dea0e29..539d867cbc9eae61db9a597483ff74a43b24fb6c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-12-06  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_reset): Don't
+       commit from reset, it upstets GtkTextView.
+
+       * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): Be more
+       careful when turning blinking on and off.
+       (gtk_text_view_focus_out_event): Make the cursor really invisible
+       when the focus goes away.  (#323087, Sadrul Habib Chowdhury)
+       (cursor_blinks): Check the gtk-cursor-blink setting first.
+
        * gtk/gtktreeview.c (gtk_tree_view_key_press): Fix refcounting
        issues with new_event and its window.
 
index 5931b5ad2d89e88a5c52b37a321944196dea0e29..539d867cbc9eae61db9a597483ff74a43b24fb6c 100644 (file)
@@ -1,5 +1,14 @@
 2005-12-06  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_reset): Don't
+       commit from reset, it upstets GtkTextView.
+
+       * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): Be more
+       careful when turning blinking on and off.
+       (gtk_text_view_focus_out_event): Make the cursor really invisible
+       when the focus goes away.  (#323087, Sadrul Habib Chowdhury)
+       (cursor_blinks): Check the gtk-cursor-blink setting first.
+
        * gtk/gtktreeview.c (gtk_tree_view_key_press): Fix refcounting
        issues with new_event and its window.
 
index 0bea1c646f7d0c0ccf3998a2a10348abc960747d..2433af793d31d65de81220f67043e3ea7ee78fce 100644 (file)
@@ -1519,11 +1519,10 @@ gtk_im_context_simple_reset (GtkIMContext *context)
 
   context_simple->compose_buffer[0] = 0;
 
-  if (context_simple->tentative_match)
-    gtk_im_context_simple_commit_char (context, context_simple->tentative_match);
-  
   context_simple->in_hex_sequence = FALSE;
-
+  context_simple->tentative_match = 0;
+  context_simple->tentative_match_len = 0;
+  
   g_signal_emit_by_name (context_simple, "preedit_changed");
 }
 
index 4544066bfed499979c51f5ef1eef2acf5a02329a..e0978b5465c1ad461b3123fff7aba9e5cb41c517 100644 (file)
@@ -4125,8 +4125,8 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
   
   if (text_view->cursor_visible && text_view->layout)
     {
-      gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
       gtk_text_view_check_cursor_blink (text_view);
+      gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
     }
 
   g_signal_handlers_disconnect_by_func (gdk_keymap_get_for_display (gtk_widget_get_display (widget)),
@@ -4443,6 +4443,11 @@ cursor_blinks (GtkTextView *text_view)
   if (gtk_debug_flags & GTK_DEBUG_UPDATES)
     return FALSE;
 
+  g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
+
+  if (!blink)
+    return FALSE;
+
   if (text_view->editable)
     {
       GtkTextMark *insert;
@@ -4452,10 +4457,7 @@ cursor_blinks (GtkTextView *text_view)
       gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
       
       if (gtk_text_iter_editable (&iter, text_view->editable))
-       {
-         g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
-         return blink;
-       }
+       return blink;
     }
 
   return FALSE;
@@ -4515,9 +4517,7 @@ blink_cb (gpointer data)
   g_signal_handlers_block_by_func (text_view->layout,
                                    changed_handler,
                                    text_view);
-
   gtk_text_layout_set_cursor_visible (text_view->layout, !visible);
-
   g_signal_handlers_unblock_by_func (text_view->layout,
                                      changed_handler,
                                      text_view);
@@ -4546,22 +4546,29 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
 {
   if (text_view->layout != NULL &&
       text_view->cursor_visible &&
-      GTK_WIDGET_HAS_FOCUS (text_view) &&
-      cursor_blinks (text_view))
+      GTK_WIDGET_HAS_FOCUS (text_view))
     {
-      if (text_view->blink_timeout == 0)
+      if (cursor_blinks (text_view))
        {
+         if (text_view->blink_timeout == 0)
+           {
+             gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
+             
+             text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER,
+                                                       blink_cb,
+                                                       text_view);
+           }
+       }
+      else
+       {
+         gtk_text_view_stop_cursor_blink (text_view);
          gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
-         
-         text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER,
-                                                   blink_cb,
-                                                   text_view);
        }
     }
   else
     {
       gtk_text_view_stop_cursor_blink (text_view);
-      gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);    
+      gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
     }
 }
 
@@ -5721,13 +5728,14 @@ gtk_text_view_start_selection_drag (GtkTextView       *text_view,
     }
 
   gtk_text_buffer_select_range (buffer, &end, &start);
-  gtk_text_view_check_cursor_blink (text_view);
 
   data->orig_start = gtk_text_buffer_create_mark (buffer, NULL,
                                                   &start, TRUE);
   data->orig_end = gtk_text_buffer_create_mark (buffer, NULL,
                                                 &end, TRUE);
 
+  gtk_text_view_check_cursor_blink (text_view);
+
   text_view->selection_drag_handler = g_signal_connect_data (text_view,
                                                              "motion_notify_event",
                                                              G_CALLBACK (selection_motion_event_handler),